import { Component, ViewChild } from '@angular/core';

import { Platform, MenuController, Nav } from 'ionic-angular';

import { HelloIonicPage } from '../pages/hello-ionic/hello-ionic';
import { ListPage } from '../pages/list/list';
import { CeshiPage } from "../pages/ceshi/ceshi"; //pagesssssssssssssssssssss!!!
import { HerosPage } from "../pages/heros/heros";
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { TabTestPage } from '../pages/tab-test/tab-test';
import { NgDirectivePage } from '../pages/ng-directive/ng-directive';
// import{ Tab1} from '../pages/tab-test/Tab1';
// import{ Tab2} from '../pages/tab-test/Tab2';
import { SearchServicePage } from '../pages/search-service/search-service';
import{DependencyInjectionPage} from '../pages/dependency-injection/dependency-injection';
import { HeroesListComponent }   from '../pages/hero-list/hero-list';

//尝试 在component 里引入 HeroDetailPage 解决跳转黑屏的问题。
import { HeroDetailPage } from '../pages/hero-detail/hero-detail';

//

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  @ViewChild(Nav) nav: Nav;

  // make HelloIonicPage the root (or first) page
  rootPage = HelloIonicPage; //首页 加载
  pages: Array<{ title: string, component: any }>;

  constructor(
    public platform: Platform,
    public menu: MenuController,
    public statusBar: StatusBar,
    public splashScreen: SplashScreen
  ) {
    this.initializeApp();

    // set our app's pages
    this.pages = [
      { title: 'Hello Ionic', component: HelloIonicPage },
      { title: 'My First List', component: ListPage },
      { title: 'My First List2', component: ListPage },
      { title: 'test Form', component: CeshiPage },
      { title: '英雄page', component: HerosPage },
      { title: 'tab页面', component: TabTestPage },
      { title: '搜索英雄1', component: SearchServicePage },
      { title: '自定义指令/组件样式', component: NgDirectivePage },
      {title:'多级依赖注入',component:DependencyInjectionPage}
    ];
  }

  initializeApp() {
    this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      this.statusBar.styleDefault();
      this.splashScreen.hide();
    });
  }

  openPage(page) {
    // close the menu when clicking a link from the menu
    this.menu.close();
    // navigate to the new page if it is not the current page
    this.nav.setRoot(page.component);
  }
}
